import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'themePro.dart';

class ThemePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('主题改变'),
      ),
      body: Column(
        children: <Widget>[
          MaterialButton(
            onPressed: () => dart(context),
            child: Text('dart'),
          ),
          MaterialButton(
            onPressed: () => light(context),
            child: Text('light'),
          )
        ],
      ),
    );
  }


  void dart(context) {
    Provider.of<ThemePro>(context,listen: false).changeTheme('dart');
  }
  void light(context) {
    Provider.of<ThemePro>(context,listen: false).changeTheme('light');
  }

}
